import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;

import java.io.IOException;

public class LifeCycleServlet {
    import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;

import java.io.IOException;
    @WebServlet("/f2")
    public class LifeCycleServlet extends HttpServlet {

        @Override
        public void init(ServletConfig config) throws ServletException {
            System.out.println("1、LifeCycleServlet被初始化了");
            super.init(config);
        }

        @Override
        public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
            System.out.println("2、LifeCycleServlett处于service,可以接受http请求了");
            super.service(req, res);
        }

        @Override
        public void destroy() {
            System.out.println("3、LifeCycleServlet被销毁了");
            super.destroy();
        }
    }

}
